﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Himp.Outpatient.HttpApi
{
    public class OutpatientOpenApiOutput<T>
    {
        /// <summary>
        /// 接口状态码
        /// 0 成功
        /// -1 失败
        /// </summary>
        public int InfStasno { get; set; }

        /// <summary>
        /// 接收方报文ID
        /// 链路ID
        /// 时间(14)+流水号(10)
        /// </summary>
        public string RefMsgId { get; set; }

        /// <summary>
        /// 接收时间
        /// 格式：yyyyMMddHHmmssfff
        /// </summary>
        public string RecvTime { get; set; }

        /// <summary>
        /// 响应时间
        /// 格式：yyyyMMddHHmmssfff
        /// </summary>
        public string ResTime { get; set; }

        /// <summary>
        /// 输出
        /// </summary>
        public string? Output { get; set; }

        /// <summary>
        /// 错误信息
        /// 交易失败状态下，业务返回的错误信息
        /// </summary>
        public string? ErrMsg { get; set; }

        public OutpatientOpenApiOutput(T result,string recvTime, string refMsgId)
        {
            InfStasno = 0;
            ErrMsg = string.Empty;
            RefMsgId = refMsgId;
            RecvTime = recvTime;
            ResTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            if(result != null) 
            {
                Output = Newtonsoft.Json.JsonConvert.SerializeObject(result);
            }
        }
    }

    public class OutpatientOpenApiOutput
    {
        /// <summary>
        /// 接口状态码
        /// 0 成功
        /// -1 失败
        /// </summary>
        public int InfStasno { get; set; }

        /// <summary>
        /// 接收方报文ID
        /// 链路ID
        /// 时间(14)+流水号(10)
        /// </summary>
        public string RefMsgId { get; set; }

        /// <summary>
        /// 接收时间
        /// 格式：yyyyMMddHHmmssfff
        /// </summary>
        public string RecvTime { get; set; }

        /// <summary>
        /// 响应时间
        /// 格式：yyyyMMddHHmmssfff
        /// </summary>
        public string ResTime { get; set; }

        /// <summary>
        /// 输出
        /// </summary>
        public string? Output { get; set; }

        /// <summary>
        /// 错误信息
        /// 交易失败状态下，业务返回的错误信息
        /// </summary>
        public string? ErrMsg { get; set; }

        public OutpatientOpenApiOutput(string recvTime, string refMsgId)
        {
            InfStasno = 0;
            ErrMsg = string.Empty;
            RefMsgId = refMsgId;
            RecvTime = recvTime;
            ResTime = DateTime.Now.ToString("yyyyMMddHHmmss");
        }
    }
}
